package com.liuxing.javaSpringBoot.modules.spider.controller;

import com.liuxing.javaSpringBoot.modules.common.entity.Result;
import com.liuxing.javaSpringBoot.modules.spider.entity.Coronavirus;
import com.liuxing.javaSpringBoot.modules.spider.service.CoronavirusesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 * @File CoronavirusController.java
 * @Auth liuxing
 * @Date 2021/8/30 15:10
 * @Email liuxing997@foxmail.com
 */
@RestController
@RequestMapping("/api")
public class CoronavirusController {

    @Autowired
    private CoronavirusesService coronavirusService;

    /**
     * 127.0.0.1/api/coronaviruses ---- get
     */
    @GetMapping("/coronaviruses")
    public Result<Object> getCoronaviruses() {
        return new Result<>(Result.ResultCode.SUCCESS.code, "获取数据成功！", coronavirusService.getCoronaviruses());
    }
}

